package com.ledim.bean;

import java.io.Serializable;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import com.ledim.db.dao.DaoSession;
import com.ledim.db.dao.LedimPicBeanDao;

/**
 * Created by ccx on 16/6/22.
 * 图片信息
 */
@Entity(
        //  实体是否激活的标志，激活的实体有更新，删除和刷新的方法
        active = true,
        // 确定数据库中表的名称
        // 表名称默认是实体类的名称
        nameInDb = "PHOTO")
public class LedimPicBean implements Serializable {

    @Property(nameInDb = "Id")
    @Id(autoincrement = true)
    private Long id;

    @Property(nameInDb = "width")
    public int width; // 图片宽
    @Property(nameInDb = "height")
    public int height; // 图片高
    @Property(nameInDb = "thumb")
    public String thumb; // 缩略图URL
    @Property(nameInDb = "large")
    public String large; // 大图URL

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /** Used for active entity operations. */
    @Generated(hash = 1705851760)
    private transient LedimPicBeanDao myDao;

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    public String getLarge() {
        return this.large;
    }

    public void setLarge(String large) {
        this.large = large;
    }

    public String getThumb() {
        return this.thumb;
    }

    public void setThumb(String thumb) {
        this.thumb = thumb;
    }

    public int getHeight() {
        return this.height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public int getWidth() {
        return this.width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1238921718)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getLedimPicBeanDao() : null;
    }

    @Generated(hash = 1431848082)
    public LedimPicBean(Long id, int width, int height, String thumb, String large) {
        this.id = id;
        this.width = width;
        this.height = height;
        this.thumb = thumb;
        this.large = large;
    }

    @Generated(hash = 410821628)
    public LedimPicBean() {
    }

}
